package cn.tk.repository.mr;

import cn.tk.model.entity.mr.Flow;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by denglw on 2021/8/2.<br/>
 * Desc: 流程 dao
 */
@Repository("mrFlowDao")
public interface FlowDao extends JpaRepository<Flow, Long> {

    /**
     * 获取唯一记录<br/>
     * @param id id
     * @return 记录
     */
    @Override
    @Query(value = "select * from mr_bot_flow where id=?1 and deleted=0 and disabled=0", nativeQuery = true)
    Flow getOne(Long id);

    /**
     * 获取所有记录.<br/>
     * @return list
     */
    @Override
    @Query(value = "select * from mr_bot_flow where deleted=0 and disabled=0", nativeQuery = true)
    List<Flow> findAll();
}
